package com.example.lj.uav.view;

import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.example.lj.uav.R;
import com.example.lj.uav.view.base.BaseActivity;

import static com.example.lj.uav.MyApplication.mPref;

public class ImproveActivity extends BaseActivity implements View.OnClickListener {
    private TextView mTvUserAgreement;
    private TextView mTvRefuse;
    private Button mBtnSubmit;
    private View mUserAgreement;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_improve);
        mTvUserAgreement = findViewById(R.id.tv_improve_agreement);
        mTvRefuse = findViewById(R.id.tv_improve_refuse);
        mBtnSubmit = findViewById(R.id.btn_improve_add);
        mUserAgreement = findViewById(R.id.layout_user_agreement);
        mBtnSubmit.setOnClickListener(this);
        mTvRefuse.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.tv_improve_refuse:
                mPref.edit().putBoolean("product_improvement_plan", false).apply();
                toAct(MainActivity.class,true);
                break;
            case R.id.tv_improve_agreement:
                mTvUserAgreement.setVisibility(View.GONE);
                mUserAgreement.setVisibility(View.VISIBLE);
                break;
            case R.id.btn_improve_add:
                mPref.edit().putBoolean("product_improvement_plan", true).apply();
                toAct(MainActivity.class,true);
                break;
        }
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        return false;
    }
}
